package ccrClasses.layer1.medications;

import ccrClasses.ICcr;
import ccrClasses.layer2.DateTime;
import ccrClasses.layer2.Directions;
import ccrClasses.layer2.FullfillmentHistory;
import ccrClasses.layer2.Product;
import ccrClasses.layer2.Source;
import ccrClasses.layer2.Status;

public class Medication implements ICcr {
	
	public final static String OPEN_TAG = "<Medication>";

	public final static String CLOSE_TAG = "</Medication>";
	
	private Status status;
	
	private DateTime startDateTime;
	
	private DateTime stopDateTime;
	
	private DateTime prescriptionDate;
	
	private DateTime dispenseDate;
	
	private Source source;
	
	private Product	product;
	
	private Directions directions;
	
	private FullfillmentHistory fullfillmentHistory;
	
	

	public Medication(Status status, DateTime startDateTime,
			DateTime stopDateTime, Source source, Product product,
			Directions directions, FullfillmentHistory fullfillmentHistory) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
		this.source = source;
		this.product = product;
		this.directions = directions;
		this.fullfillmentHistory = fullfillmentHistory;
	}
	
	public Medication(Status status) {
		super();
		this.status = status;
	}

	public Medication(Status status, DateTime startDateTime) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
	}

	public Medication(Status status, DateTime startDateTime,
			DateTime stopDateTime) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
	}

	public Medication(Status status, DateTime startDateTime,
			DateTime stopDateTime, Source source) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
		this.source = source;
	}

	public Medication(Status status, DateTime startDateTime,
			DateTime stopDateTime, Source source, Product product) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
		this.source = source;
		this.product = product;
	}

	public Medication(Status status, DateTime startDateTime,
			DateTime stopDateTime, Source source, Product product,
			Directions directions) {
		super();
		this.status = status;
		this.startDateTime = startDateTime;
		this.stopDateTime = stopDateTime;
		this.source = source;
		this.product = product;
		this.directions = directions;
	}

	public Medication() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public String constructCcrString() {
		String ccrMedication = OPEN_TAG;
		if(status != null){
			ccrMedication = ccrMedication + status.constructCcrString();
		}
		
		if(startDateTime != null){
			ccrMedication = ccrMedication + startDateTime.constructCcrString();
		}
		
		if(stopDateTime != null){
			ccrMedication = ccrMedication + stopDateTime.constructCcrString();
		}
		
		if(prescriptionDate != null){
			ccrMedication = ccrMedication + prescriptionDate.constructCcrString();
		}
		
		if(dispenseDate != null){
			ccrMedication = ccrMedication + dispenseDate.constructCcrString();
		}
		
		if(source != null){
			ccrMedication = ccrMedication + source.constructCcrString();
		}

		if(product != null){
			ccrMedication = ccrMedication + product.constructCcrString();
		}
		
		if(directions != null){
			ccrMedication = ccrMedication + directions.constructCcrString();
		}
		
		if(fullfillmentHistory != null){
			ccrMedication = ccrMedication + fullfillmentHistory.constructCcrString();
		}
		
		ccrMedication = ccrMedication + CLOSE_TAG;
		return ccrMedication;
	}

	/**
	 * @return the status
	 */
	public Status getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(Status status) {
		this.status = status;
	}

	/**
	 * @return the startDateTime
	 */
	public DateTime getStartDateTime() {
		return startDateTime;
	}

	/**
	 * @param startDateTime the startDateTime to set
	 */
	public void setStartDateTime(DateTime startDateTime) {
		this.startDateTime = startDateTime;
	}

	/**
	 * @return the stopDateTime
	 */
	public DateTime getStopDateTime() {
		return stopDateTime;
	}

	/**
	 * @param stopDateTime the stopDateTime to set
	 */
	public void setStopDateTime(DateTime stopDateTime) {
		this.stopDateTime = stopDateTime;
	}

	/**
	 * @return the source
	 */
	public Source getSource() {
		return source;
	}

	/**
	 * @param source the source to set
	 */
	public void setSource(Source source) {
		this.source = source;
	}

	/**
	 * @return the product
	 */
	public Product getProduct() {
		return product;
	}

	/**
	 * @param product the product to set
	 */
	public void setProduct(Product product) {
		this.product = product;
	}

	/**
	 * @return the directions
	 */
	public Directions getDirections() {
		return directions;
	}

	/**
	 * @param directions the directions to set
	 */
	public void setDirections(Directions directions) {
		this.directions = directions;
	}

	/**
	 * @return the fullfillmentHistory
	 */
	public FullfillmentHistory getFullfillmentHistory() {
		return fullfillmentHistory;
	}

	/**
	 * @param fullfillmentHistory the fullfillmentHistory to set
	 */
	public void setFullfillmentHistory(FullfillmentHistory fullfillmentHistory) {
		this.fullfillmentHistory = fullfillmentHistory;
	}

	/**
	 * @param prescriptionDate the prescriptionDate to set
	 */
	public void setPrescriptionDate(DateTime prescriptionDate) {
		this.prescriptionDate = prescriptionDate;
	}

	/**
	 * @return the prescriptionDate
	 */
	public DateTime getPrescriptionDate() {
		return prescriptionDate;
	}

	/**
	 * @param dispenseDate the dispenseDate to set
	 */
	public void setDispenseDate(DateTime dispenseDate) {
		this.dispenseDate = dispenseDate;
	}

	/**
	 * @return the dispenseDate
	 */
	public DateTime getDispenseDate() {
		return dispenseDate;
	}

}
